/**
 * Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.cms.contenttype.entity;

import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.modules.cms.column.entity.CmsColumn;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

/**
 * 栏目内容分类Entity
 *
 * @author Sawyer
 * @version 2020-11-22
 */
@Getter
@Setter
@ToString
public class CmsContentType extends DataEntity<CmsContentType> {

    private static final long serialVersionUID = 1L;

    @Length(min = 2, max = 32, message = "分类名称长度必须介于 2 和 32 之间")
    @ExcelField(title = "分类名称", align = 2, sort = 1)
    private String name;

    @NotNull(message = "栏目ID不能为空")
    private CmsColumn column;

    @NotNull(message = "排序不能为空")
    @ExcelField(title = "排序", align = 2, sort = 9)
    private Integer sort;

    /**
     * 所属站点,不在界面上显示，隐性关联
     */
    private String siteId;

    public CmsContentType() {
        super();
        this.setIdType(IDTYPE_AUTO);
    }

    public CmsContentType(String id) {
        super(id);
    }

    public CmsContentType(CmsColumn column) {
        this.column = column;
    }
}
